<%@ page language="java" import="java.util.*,com.hs.dict.model.*,com.hs.core.utils.*,com.hs.core.cache.*" pageEncoding="utf-8"%>
<% 
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  String dictname = (String)request.getAttribute("dictname");
  String dicttype = (String)request.getAttribute("dicttype");
  PageUtil pageUtil = (PageUtil)request.getAttribute("dictList");
   String orderName = (String)request.getAttribute("orderName");
	String orderNum = (String)request.getAttribute("orderNum"); 
  
  Map menu = (Map)request.getAttribute("menu");
   
  String pageStr = ""; 
    int perpageCount = 1;
	int currentPage = 1;
	List dataList = null;
	if(null != pageUtil){
   dataList = pageUtil.getPageList();
   pageStr = pageUtil.getPageStr();
   perpageCount = pageUtil.getNumberPerPage();
   currentPage = pageUtil.getCurrentPage();
} 

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head> 
<title></title>
<script src="<%=basePath %>app/javascripts/jquery-1.5.1.js"></script>
<script src="<%=basePath %>app/javascripts/layout.js"></script>
<script src="<%=basePath %>common/javascript/common.js"></script>
<script src='<%=basePath%>dwr/engine.js'></script>
<script src='<%=basePath%>dwr/util.js'></script> 
<script src='<%=basePath%>dwr/interface/dictdwr.js'></script> 
<link rel="stylesheet" type="text/css" href="<%=basePath %>app/css/layout.css">
<style>.tac{text-align:center}</style>
<script>
function searchData(){

searchform.submit();
}

function modifyData(id){
	
     window.parent.dictinfo.frameElement.src = "<%=basePath%>dict/addDict.do?id="+id; 
 
}
 function delDict(id){
 	if(confirm("确定要删除该用户数据项吗?")){
 		dictdwr.delDict(id,callback4delete);
 	}
 }
 function callback4delete(){
    alert("成功删除数据项!"); 
	searchData();
 }
 function addDict(){
 	     window.parent.dictinfo.frameElement.src = "<%=basePath%>dict/addDict.do"; 
 	
 
 }
</script>
</head>
<body>
    <div class="cont">     
    <form name="searchform" action="<%=basePath %>dict/listDict.do" method="post">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sear">
			 <tr>
			     <td width="15%">
			       字典名称：
			       <input type="hidden" name="dicttype" value="<%=dicttype==null?"":dicttype%>" />
			       </td>
			       <td width="50%">
 						<input  name ="dictname" style="width:99%" value="<%=dictname==null?"":dictname %>"  /> 
			       </td> 
			    <td width="15%">
			      <input onclick="searchData();" type="button" value="查询" class="butt2"/> 
 			    </td>
			    <td width="15%">
            		  <input onclick="addDict();" type="button" value="新增" class="butt4"/> 
			    </td>
			</tr>
		</table>
        </form>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
          <tr> 
            <th width="10%" nowarp>序号</th>
		    <th width="20%">字典类型</th>
		    <th width="20%">字典名称</th> 
		    <th width="10%" nowrap>字典编码</th>
		    <th width="10%" nowrap>是否默认值</th>
		    <th width="10%">有效标记</th>
		    <th width="10%">修改</th>  
		    <th width="10%">删除</th>  
          </tr>
          <%if(null != dataList && dataList.size()>0){ 
		       for(int i =0;i<dataList.size();i++){
		            HsCode data = (HsCode)dataList.get(i);
		            int j = i%2;
		            boolean flag = false;
		            if(j==0)
		               flag = true;
  			%>
     
	  <TR class=<%if(flag){ out.print("t_bg");}else{out.print("t_bg1");}%> align="center">
	    <TD > <%= perpageCount*(currentPage-1)+i+1 %></TD>
	    <TD><%=DictCacheUtil.getInst().selectStr4Display(data.getDicttype()+"","2")%></TD>
	    <TD><%=StringUtilTool.NULL2Blank(data.getDictname()) %></TD> 
	    <TD><%=data.getDictcode() %></TD> 
	    <TD align="center"><%if("1".equals(data.getIsdefault()+"")){out.println("是");}else{out.print("否");}%></TD> 
	    <TD><%=DictCacheUtil.getInst().selectStr4Display(data.getYouxbj()+"","1") %></TD> 
	     
	    <TD><input type="button" value=" 修 改 " onclick="modifyData('<%=data.getId() %>');"></TD>
	     <TD><input type="button" value=" 删 除 " onclick="delDict('<%=data.getId() %>');"></TD>
 	  
	    </TR> 
     <%}}else{ %>
         <TR class=t_bg1 align="center">
	    	<TD colspan="8"><font color="red"><b>没有字典配置记录</b></font></TD> 
	    </TR>   <%} %> 
          <tr >
	          <td colspan=8 align=right>
	          <%=pageStr  %>
	          </td>
          </tr>
         
          
        </table>
		
        
  </div>

</body>
</html>
